<template>
	<view>
	
	<view class="Box">
		<view class="balance">{{member_info.member_gold}}</view>
		<view  style="font-size: 28rpx;color: #000;">可用余额</view>
		<view class="Recharge" @click="Recharge()">充值</view>
	</view>
		
	<view style="height: 10rpx;background-color: #EEEEEE;"></view>
		<view class="List" v-for="(item,index) in InfoList" :key="index">
			<view class="flex">
				<view class="Nume">
					{{item.pl_gold}}<image style="width: 30rpx;height: 30rpx;margin-left: 10rpx;" :src="`${picUrl}/w/xjb.png`" mode=""></image>
				</view>
				<view class="Title">
					{{item.pl_add_time |formaDate}}
				</view>
			</view>
			<view class="Name">
				{{item.pl_desc}}
			</view>
		</view>
	
	</view>
</template>

<script>
	export default {
		data() {
			return {
				InfoList:"",
				member_info:"",
				curpage:1
			}
		},
		onLoad() {
			uni.setNavigationBarTitle({
				title:"我的金币"
			})
			this.getList()
		},
		onReachBottom(e) {
			if(this.curpage){
				this.getList(true)
			}else{
				uni.showToast({
					title:"到底了哦~~",
					icon:"none"
				})
			}
		},
		methods: {
			Recharge(){
				uni.navigateTo({
					url:"/live/user/manage/recharge"
				})
			},
			getList(state){
				this.$util.request({
					url: '/live/index.php?act=api-gold&op=gold_log_list',
					method: 'get',
					data: {curpage:this.curpage},
				}).then((res)=>{
					if (res.error_code == 0) {
						this.member_info=res.datas.member_info
						if(state){
							this.InfoList=this.InfoList.concat(res.datas.list_log)  
						}else{
							this.InfoList=res.datas.list_log
						}
						if(res.datas.paged.hasmore){
							this.curpage++
						}else{
							this.curpage=false
						}
						
						
					} else {
						uni.showToast({
							title: res.message,
							icon: "none"
						});
					}
				})	
			}
		}
	}
</script>

<style scoped>
	.Recharge{
		background-color: #F4CE5B;
		width: 120rpx;
		text-align: center;
		margin-left: 600rpx;
		border-radius: 30rpx;
	}
	.balance{
		font-size: 34rpx;
		font-weight: bold;
		color: #000;
	}
	.Box{
		background: url(/live/static/images/signinBg.png) no-repeat;
		color: #FFFFFF;
		text-align: center;
		padding-top: 40rpx;
		padding-bottom: 20rpx;
	}
	.Title{
		color: #999999;
		font-size: 24rpx;
	}
	.Nume{
		font-size: 30rpx;
		font-weight: bold;
		color: red ;
	}
	.List{
		border-bottom: 1rpx solid #EEEEEE;
		padding: 20rpx 40rpx;
		line-height: 35rpx;
	}
	.Name{
		font-size: 28rpx;
	}
	page{
		background-color: #FFFFFF;
	}
	.flex{
		display: flex;
		justify-content: space-between;
		align-items: center;
	}
</style>
